package com.headingdata.define;

public class MethodDemo3 {
    public static void main(String[] args) {
        int s = sum(10);
        System.out.println(s);
        judge(10);
        judge(15);
    }
    public static int sum(int n){
        int sum = 0;
        for (int i = 1;i <= n;i++){
            sum += i;
        }
        return sum;
    }
    public static void judge(int num){
        if(num % 2 == 0){
            System.out.println("您输入的数据是偶数！");
        }else{
            System.out.println("您输入的数据是奇数！");
        }
    }
}
